import HttpService from '../../app/services/httpService.js';

class GroupService extends HttpService {
    constructor($http, $q){
        super($http, $q)

        this.URL = this.baseUrl();

        this.OBJ = {
        	GroupListUrl: this.URL + '/group/lists?race_id=',
            GroupCreateUrl: this.URL + '/group/create?race_id=',
            GroupDetailUrl: this.URL + '/group/detail?group_id=',
            GroupUpdateUrl: this.URL + '/group/update?group_id=',
            GroupDelUrl: this.URL + '/group/del?race_id=',
        }

    }

    /* 获取分组列表 */
    getGroupList(headers, search) {
        return this.getRequest(this.OBJ.GroupListUrl, headers, search);
    }
    
    /* 创建分组 */
    postGroupCreate(params, headers, search) {
        return this.postRequest(this.OBJ.GroupCreateUrl, params, headers, search);
    }
    
    /* 获取分组详情 */
    getGroupDetail(headers, search) {
        return this.getRequest(this.OBJ.GroupDetailUrl, headers, search);
    }
    
    /* 更新分组 */
    postGroupUpdate(params, headers, search) {
        return this.postRequest(this.OBJ.GroupUpdateUrl, params, headers, search);
    }
    
    /* 删除分组 */
    postGroupDel(params, headers, search) {
        return this.postRequest(this.OBJ.GroupDelUrl, params, headers, search);
    }

}

export default GroupService;